﻿@model CID.Domain.Development.Component

@{
    ViewBag.Title = "Manage Component Versions";
}

<h2>Manage Component Versions</h2>
<div class="display-label">@Html.LabelFor(m => m.Name)</div>
<div class="display-field">
    @Html.DisplayFor(model => model.Name)
</div>

<div class="display-label">@Html.LabelFor(m => m.Description)</div>
<div class="display-field">
    @Html.DisplayFor(model => model.Description)
</div>

<p> 
    @Html.ActionLink("Create New", "CreateVersion", new { id = Model.Id } )
</p>
<table>
    <tr>
        <th>
            Name
        </th>
        <th>
            Description
        </th>
        <th>
            Release
        </th>
        <th>
            Status
        </th>
        <th></th>
    </tr>

@foreach (var item in Model.Versions) {
    <tr>
        <td>
            @Html.DisplayFor(m => item.Name)
        </td>
        <td>
            @Html.DisplayFor(m => item.Description)
        </td>
        <td>
            @if (item.Release != null)
            {
                @Html.DisplayFor(m => item.Release.Name)
            }
        </td>
        <td>
            @if (item.Release != null)
            {
                @Html.DisplayFor(m => item.Release.Status)
            }
        </td>
        <td>
            @Html.ActionLink("Edit", "EditVersion", new { id = item.Id }) |
            @Html.ActionLink("Create Copy", "CreateVersionCopy", new { originalId = item.Id }) |
            @Html.ActionLink("Details", "DetailsVersion", new { id = item.Id }) |
            @Html.ActionLink("Delete", "DeleteVersion", new { id = item.Id })
        </td>
    </tr>
}

</table>
